使用帶有 Curl 的緩衝輸出將文件上傳到 ftp 服務器 (Upload a file into a ftp server using buffered output with Curl)


問題描述

使用帶有 Curl 的緩衝輸出將文件上傳到 ftp 服務器 (Upload a file into a ftp server using buffered output with Curl)

I want to upload a database backup file into an external ftp server using curl. I use postgres and pg_dump streams the content of file into buffered output. I tried 

echo pg_dump dbname| gzip" | curl ‑d @‑ ftp://user:pass@host:/pg_dump/$(date +"%Y%m%d%H%M")_dump.gz

but it doesn't work. Any suggestion?


參考解法

方法 1:

I tried 

pg_dumpall | gzip | curl ‑T ftp://user:pass@host:/pg_dump/$(date +"%Y%m%d%H%M")_dump.gz 

and it worked.

(by burak emreburak emre)

參考文件

  1. Upload a file into a ftp server using buffered output with Curl (CC BY‑SA 3.0/4.0)

#pg-dump #curl #libcurl #linux






相關問題

如何檢查我是否只刪除了所需的數據? (How do I check that I removed required data only?)

無法恢復 pg_dump 備份 (Unable to restore pg_dump backup)

使用帶有 Curl 的緩衝輸出將文件上傳到 ftp 服務器 (Upload a file into a ftp server using buffered output with Curl)

帶有 -C 選項的 pg_restore 不會創建數據庫 (pg_restore with -C option does not create the database)

pg_dump 數據庫轉儲是“當時”轉儲嗎? (Is a pg_dump DB dump 'at-that-time' dump?)

PSQL 數據庫傳輸和錯誤 (PSQL database transfer and errors)

Postgres pg_dump 顯示空文件 (Postgres pg_dump show empty file)

將 pg_restore 與多個轉儲一起使用時管理外鍵 (Managing foreign keys when using pg_restore with multiple dumps)

設計:在不斷創建和刪除表時運行 pg_dump (Design: running pg_dump when tables are continuously created and dropped)

轉儲文件中視圖預定義的目的是什麼 (What is the purpose of views' predefinitions in dump file)

如何附加 pg_dump 備份命令 PostgreSQL 的日誌輸出 (How to append log output of pg_dump backup command PostgreSQL)

PostgreSQL:單個表的 pg_dump (PostgreSQL: pg_dump for a single table)







留言討論